﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.Entity;
using School.Entities;
using School.Accounting;

namespace School.Pages.Accounting
{
    public partial class PaymentOrders : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            GridView1.DataSource = PaymentOrder.All().Select(x => new {x.Payment_Order_Number, x.Value, SName = x.TE_Student.Ar_FirstName + " " + x.TE_Student.Ar_SecondName + " " + x.TE_Student.Ar_ThirdNmae + " " + x.TE_Student.Ar_FourthName,x.Date});
            GridView1.DataBind();

            long number = 0;

            if(long.TryParse(Request.QueryString["Number"], out number))
            {
                string strbScript = "";
                strbScript = "<script language='javascript'>";
                strbScript = strbScript + "window.open('PaymentOrderPrinting.aspx?Number="+number.ToString()+"', true, 'height=600,width=800,status=no,toolbar=no,menubar=no,location=no')";
                strbScript = strbScript + "</script>";

                Response.Write(strbScript);
            }
        }
    }
}